import { SupplierRequest, Request } from '@/plugins/supplier-request'
import { SUPPLIER_QUALIFICATION_PATH, EXPORT_PATH } from './../constans'

// 供应商管理 - 合格供应商 - 列表查询
export const queryQualifiedSupplierListService = (data, loadingFn) => SupplierRequest({
  url: `${SUPPLIER_QUALIFICATION_PATH}/list`,
  type: 'post',
  data,
  loadingFn
});

// 供应商管理 - 合格供应商 - 导出文件
export const exportQualifiedSupplierFileService = (data, loadingFn) => SupplierRequest({
  url: `${EXPORT_PATH}/export-qualified-query`,
  type: 'get',
  data,
  loadingFn,
  isExport: true
});

// 供应商管理 - 合格供应商 - 判断是否为重复是否为开票供应商
export const checkSupplierName = (data) => {
  return Request(`${SUPPLIER_QUALIFICATION_PATH}/checkSupplierName`, 'post', data)
}

// 供应商管理 - 合格供应商 - 根据开票供应商代码、开票供应商名称, 查询开票供应商信息
export const queryInvoiceSupplierInfoService = (data) => {
  return Request(`${SUPPLIER_QUALIFICATION_PATH}/query-invoice-supplier`, 'post', data)
}

// 供应商管理 - 合格供应商 - 新建合格供应商
export const saveQualifiedSupplier = (data) => {
  return Request(`${SUPPLIER_QUALIFICATION_PATH}/save-qualified-supplier`, 'post', data)
}

// 供应商管理 - 合格供应商 - 根据供应商id 查询供应商详情
export const querySupplierDetail = (data) => {
  return Request(`/supplier/query-supplier-detail`, 'get', data)
}

// 供应商管理 - 合格供应商 - 批量提交业务对接人
export const batchHandoverBusinessContact = (data) => {
  return Request(`${SUPPLIER_QUALIFICATION_PATH}/batch-handover-business-contact`, 'post', data)
}

// 供应商管理 - 合格供应商 - 根据供应商ids查询供应商业务对接人
export const queryBusinessContacts = (data) => {
  return Request(`${SUPPLIER_QUALIFICATION_PATH}/query-business-contacts`, 'post', data)
}
